/**
* Class representing a single parameter for a published or subscibed message
*/
jsx3.lang.Class.defineClass("tibco.admin.util.component.Param",
        jsx3.lang.Object,
        null,
        function(config) {

            /**
            * Name of the parameter
            * @private
            */
            config.prototype.name = null;

            /**
            * Description of the parameter
            * @private
            */
            config.prototype.description = null;

            /**
             * Constructor for this class.
             *
             * @param doc {jsx3.xml.Entity} an xml node containing the information for a single parameter of a published
             *                              or subscribed message
             * @throws {tibco.admin.exception.InvalidComponentSchemaException} if the xml is invalid
             */
            config.prototype.init = function(doc) {
                this.jsxsuper();
                var children = doc.getChildNodes().iterator();
                while(children.hasNext()) {
                    var child = children.next();
                    var childName = child.getNodeName();
                    if(childName == "name") {
                        this.name = child.getValue();
                    }
                    else if(childName == "description") {
                        this.description = child.getValue();
                    }
                }
            }

            /**
            * Gets the name of the parameter
            *
            * @return {String} the name of the parameter
            */
            config.prototype.getName = function() {
                return this.name;
            }

            /**
            * Gets the description of the parameter
            *
            * @return {String} the description of the parameter
            */
            config.prototype.getDescription = function() {
                return this.description;
            }

            /**
             * Returns a string representing this object in the xml format specified by the component.xsd schema
             *
             * @param prepend {String} a string to be prepended to each line of the returned XML (useful for indenting)
             *
             * @returns {String} this ComponentConfig as XML, as specified by the component.xsd schema
             */
            config.prototype.toString = function(prepend) {
                if(!prepend) {
                    prepend + "";
                }
                var ret = prepend + "<param>\n";
                if(this.description) {
                    ret += prepend + "   <description>" + this.description + "</description>\n";
                }
                if(this.name) {
                    ret += prepend + "   <name>" + this.name + "</name>\n";
                }
                ret += prepend + "</param>\n";
                return ret;
            }
        }
);